from Base.base import Base
from selenium.webdriver.common.by import By
import time

class Page7(Base):
    #定位器
    frames_loc=(By.XPATH,'/html/body/div[3]/div[3]/div[1]/div/div[3]/div[1]/div[2]/iframe')
    username_loc=(By.NAME,'email')
    password_loc=(By.NAME,'password')
    login_loc=(By.ID,'dologin')


    #封装进入frame框架的方法
    def frames(self):
        self.frame_open(self.frames_loc)

    #封装输入用户名的方法
    def username(self):
        self.send_keys(self.username_loc,'17306824601')

    #封装输入密码的方法
    def password(self):
        self.send_keys(self.password_loc,'PLMqaz051014')

    #封装点击登录的方法
    def login(self):
        self.click(self.login_loc)

    def luoji_login(self):
        self.open_url('https://mail.163.com/')
        self.frames()
        self.username()
        self.password()
        time.sleep(5)
        self.login()
        self.frame_close()
        time.sleep(3)